package com.caszx.chargingpile.holder.battery;

import android.bluetooth.BluetoothDevice;
import android.view.View;
import android.widget.TextView;

import com.app.base.adapter.holder.BaseHolder;
import com.caszx.chargingpile.R;
import com.caszx.chargingpile.entity.EntityBluetooth;

/**
 * Created by think on 2016/2/18.
 */
public class BluetoothHolder extends BaseHolder<BluetoothDevice>{

   private TextView txt_name;
   private TextView txt_connect;

    public BluetoothHolder(View view) {
        super(view);
    }

    @Override
    protected void initView() {
        txt_name = (TextView) mRootView.findViewById(R.id.txt_name);
        txt_connect = (TextView) mRootView.findViewById(R.id.txt_connect);

    }

    @Override
    protected void refreshView() {
        txt_name.setText(mItem.getName());
        if(mItem.getBondState() == BluetoothDevice.BOND_NONE){
            txt_connect.setVisibility(View.GONE);
        }else  if(mItem.getBondState() == BluetoothDevice.BOND_BONDING){
            txt_connect.setVisibility(View.VISIBLE);
            txt_connect.setText("正在绑定...");
        }else  if(mItem.getBondState() == BluetoothDevice.BOND_BONDED){
            txt_connect.setVisibility(View.VISIBLE);
            txt_connect.setText("已经绑定");
        }
    }
}
